﻿using Kingdee.BOS.App.Data;
using Kingdee.BOS.Contracts;
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.Metadata;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace NS.MaterialChange
{
    [HotUpdate]
    [Description("变更单审核后反写物料或SKU新品规则表")]
    public class Material : AbstractOperationServicePlugIn
    {
        public override void OnPreparePropertys(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.PreparePropertysEventArgs e)
        {
            e.FieldKeys.Add("FID");
            base.OnPreparePropertys(e);
        }

        public override void AfterExecuteOperationTransaction(AfterExecuteOperationTransaction e)
        {
            base.AfterExecuteOperationTransaction(e);
            foreach (DynamicObject item in e.DataEntitys)
            {
                string F_WNEG_Text4 = "", FNAME="";
                string FID = "", FNUMBER="", F_WNEG_COMBO ="", F_WNEG_SPECIFICATION1="", F_WNEG_REMARK51="", F_WNEG_ERPCLSID1="", F_WNEG__WLLZ_REMARK2="", F_WNEG_DATE1="",
                    F_WNEG__WLLZ_TEXT13="",F_WNEG__WLLZ_TEXT113 = "", F_WNEG__WLLZ_TEXT1111="", F_WNEG__WLLZ_TEXT1121="", F_WNEG__WLLZ_TEXT121="",
                    F_WNEG_TEXT12="",F_WNEG_TEXT3 = "", F_WNEG__WLLZ_REMARK11="", F_WNEG__WLLZ_TEXT3="",

                    F_WNEG_DEFAULTVENDOR1="", F_WNEG__QZPV_REMARK2="", F_WNEG__QZPV_REMARK11="", F_WNEG__QZPV_PRICE2="", F_WNEG__QZPV_TEXT11="",
                    F_WNEG__WLLZ_TAXRATEID1="", F_WNEG__QZPV_PRICE11="", F_WNEG_ASSISTANT1="", F_WNEG_TAXRATEID11="", F_WNEG_DECIMAL4="",
                    F_WNEG_DECIMAL11="", F_WNEG_DECIMAL21="", F_WNEG_DECIMAL31="", F_WNEG_TEXT21="",

                    F_WNEG_LENGTH1="", F_WNEG_WIDTH1="", F_WNEG_HEIGHT1="", F_WNEG__WLLZ_QTY11="", F_WNEG__WLLZ_QTY21="", F_WNEG__WLLZ_QTY3="",

                    F_WNEG__QZPV_LENGTH1="", F_WNEG__QZPV_WIDTH1="", F_WNEG__QZPV_HEIGHT1="", F_WNEG__QZPV_VOLUME1="", F_WNEG__QZPV_QTY1="",
                    F_WNEG__WLLZ_TEXT21="", F_WNEG_REMARK11="", F_WNEG_REMARK21="", F_WNEG_TEXT141="",

                    F_WNEG_Text61="", F_WNEG_TEXT71="", F_WNEG_TEXT81="", F_WNEG_TEXT91="", F_WNEG__QZPV_REMARK31="", F_WNEG_TEXT151="", F_WNEG_MULLANGTEXT1="",F_WNEG_REMARK41="", F_WNEG_ASSISTANT111="", F_WNEG_TaxRateId11="";
                if (item["ID"] != null && Convert.ToString(item["ID"]) != "")
                {
                    FID = Convert.ToString(item["ID"]);
                }
                string SQL = "/*dialect*/" + string.Format(@"select T1.FNAME, F_WNEG_Text4,FNUMBER,F_WNEG_COMBO,F_WNEG_SPECIFICATION1,F_WNEG_REMARK51,F_WNEG_ERPCLSID1,F_WNEG__WLLZ_REMARK2,F_WNEG_DATE1,
F_WNEG__WLLZ_TEXT13,F_WNEG__WLLZ_TEXT113,F_WNEG__WLLZ_TEXT1111,F_WNEG__WLLZ_TEXT1121,F_WNEG__WLLZ_TEXT121,
F_WNEG_TEXT12,F_WNEG_TEXT3,F_WNEG__WLLZ_REMARK11,F_WNEG__WLLZ_TEXT3,

F_WNEG_DEFAULTVENDOR1,F_WNEG__QZPV_REMARK2,F_WNEG__QZPV_REMARK11,F_WNEG__QZPV_PRICE2,F_WNEG__QZPV_TEXT11,
F_WNEG__WLLZ_TAXRATEID1,F_WNEG__QZPV_PRICE11,F_WNEG_ASSISTANT1,F_WNEG_TAXRATEID11,F_WNEG_DECIMAL4,
F_WNEG_DECIMAL11,F_WNEG_DECIMAL21,F_WNEG_DECIMAL31,F_WNEG_TEXT21,

F_WNEG_LENGTH1,F_WNEG_WIDTH1,F_WNEG_HEIGHT1,F_WNEG__WLLZ_QTY11,F_WNEG__WLLZ_QTY21,F_WNEG__WLLZ_QTY3,

F_WNEG__QZPV_LENGTH1,F_WNEG__QZPV_WIDTH1,F_WNEG__QZPV_HEIGHT1,F_WNEG__QZPV_VOLUME1,F_WNEG__QZPV_QTY1,
F_WNEG__WLLZ_TEXT21,F_WNEG_REMARK11,F_WNEG_REMARK21,F_WNEG_TEXT141,

F_WNEG_Text61,F_WNEG_TEXT71,F_WNEG_TEXT81,F_WNEG_TEXT91,F_WNEG__QZPV_REMARK31,F_WNEG_TEXT151,F_WNEG_MULLANGTEXT1,F_WNEG_REMARK41,
F_WNEG_ASSISTANT111,F_WNEG_TaxRateId11

from WNEG_t_Cust100033 t
left join WNEG_t_Cust100033_l t1 on t.fid=t1.fid
where t.FID='{0}'", FID);
                DynamicObjectCollection DynamData = DBUtils.ExecuteDynamicObject(this.Context, SQL);
                if(DynamData.Count>0)
                {
                    F_WNEG_Text4= Convert.ToString(DynamData[0]["F_WNEG_Text4"]);
                    FNUMBER = Convert.ToString(DynamData[0]["FNUMBER"]);
                    F_WNEG_COMBO = Convert.ToString(DynamData[0]["F_WNEG_COMBO"]);
                    F_WNEG_SPECIFICATION1= Convert.ToString(DynamData[0]["F_WNEG_SPECIFICATION1"]);
                    F_WNEG_REMARK51 = Convert.ToString(DynamData[0]["F_WNEG_REMARK51"]);
                    F_WNEG_ERPCLSID1 = Convert.ToString(DynamData[0]["F_WNEG_ERPCLSID1"]);
                    F_WNEG__WLLZ_REMARK2 = Convert.ToString(DynamData[0]["F_WNEG__WLLZ_REMARK2"]);
                    F_WNEG_DATE1 = Convert.ToString(DynamData[0]["F_WNEG_DATE1"]);
                    F_WNEG__WLLZ_TEXT13 = Convert.ToString(DynamData[0]["F_WNEG__WLLZ_TEXT13"]);
                    F_WNEG__WLLZ_TEXT113 = Convert.ToString(DynamData[0]["F_WNEG__WLLZ_TEXT113"]);
                    F_WNEG__WLLZ_TEXT1111= Convert.ToString(DynamData[0]["F_WNEG__WLLZ_TEXT1111"]);
                    F_WNEG__WLLZ_TEXT1121 = Convert.ToString(DynamData[0]["F_WNEG__WLLZ_TEXT1121"]);
                    F_WNEG__WLLZ_TEXT121 = Convert.ToString(DynamData[0]["F_WNEG__WLLZ_TEXT121"]);
                    F_WNEG_TEXT12= Convert.ToString(DynamData[0]["F_WNEG_TEXT12"]);
                    F_WNEG_TEXT3 = Convert.ToString(DynamData[0]["F_WNEG_TEXT3"]);
                    F_WNEG__WLLZ_REMARK11 = Convert.ToString(DynamData[0]["F_WNEG__WLLZ_REMARK11"]);
                    F_WNEG__WLLZ_TEXT3 = Convert.ToString(DynamData[0]["F_WNEG__WLLZ_TEXT3"]);
                    F_WNEG_DEFAULTVENDOR1 = Convert.ToString(DynamData[0]["F_WNEG_DEFAULTVENDOR1"]);
                    F_WNEG__QZPV_REMARK2 = Convert.ToString(DynamData[0]["F_WNEG__QZPV_REMARK2"]);
                    F_WNEG__QZPV_REMARK11 = Convert.ToString(DynamData[0]["F_WNEG__QZPV_REMARK11"]);
                    F_WNEG__QZPV_PRICE2 = Convert.ToString(DynamData[0]["F_WNEG__QZPV_PRICE2"]);
                    F_WNEG__QZPV_TEXT11 = Convert.ToString(DynamData[0]["F_WNEG__QZPV_TEXT11"]);
                    F_WNEG__WLLZ_TAXRATEID1 = Convert.ToString(DynamData[0]["F_WNEG__WLLZ_TAXRATEID1"]);
                    F_WNEG__QZPV_PRICE11 = Convert.ToString(DynamData[0]["F_WNEG__QZPV_PRICE11"]);
                    F_WNEG_ASSISTANT1 = Convert.ToString(DynamData[0]["F_WNEG_ASSISTANT1"]);
                    F_WNEG_TAXRATEID11 = Convert.ToString(DynamData[0]["F_WNEG_TAXRATEID11"]);
                    F_WNEG_DECIMAL4 = Convert.ToString(DynamData[0]["F_WNEG_DECIMAL4"]);
                    F_WNEG_DECIMAL11 = Convert.ToString(DynamData[0]["F_WNEG_DECIMAL11"]);
                    F_WNEG_DECIMAL21 = Convert.ToString(DynamData[0]["F_WNEG_DECIMAL21"]);
                    F_WNEG_DECIMAL31 = Convert.ToString(DynamData[0]["F_WNEG_DECIMAL31"]);
                    F_WNEG_TEXT21 = Convert.ToString(DynamData[0]["F_WNEG_TEXT21"]);
                    F_WNEG_LENGTH1 = Convert.ToString(DynamData[0]["F_WNEG_LENGTH1"]);
                    F_WNEG_WIDTH1 = Convert.ToString(DynamData[0]["F_WNEG_WIDTH1"]);
                    F_WNEG_HEIGHT1 = Convert.ToString(DynamData[0]["F_WNEG_HEIGHT1"]);
                    F_WNEG__WLLZ_QTY11 = Convert.ToString(DynamData[0]["F_WNEG__WLLZ_QTY11"]);
                    F_WNEG__WLLZ_QTY21 = Convert.ToString(DynamData[0]["F_WNEG__WLLZ_QTY21"]);
                    F_WNEG__WLLZ_QTY3 = Convert.ToString(DynamData[0]["F_WNEG__WLLZ_QTY3"]);
                    F_WNEG__QZPV_LENGTH1 = Convert.ToString(DynamData[0]["F_WNEG__QZPV_LENGTH1"]);
                    F_WNEG__QZPV_WIDTH1 = Convert.ToString(DynamData[0]["F_WNEG__QZPV_WIDTH1"]);
                    F_WNEG__QZPV_HEIGHT1 = Convert.ToString(DynamData[0]["F_WNEG__QZPV_HEIGHT1"]);
                    F_WNEG__QZPV_VOLUME1 = Convert.ToString(DynamData[0]["F_WNEG__QZPV_VOLUME1"]);
                    F_WNEG__QZPV_QTY1 = Convert.ToString(DynamData[0]["F_WNEG__QZPV_QTY1"]);
                    F_WNEG__WLLZ_TEXT21 = Convert.ToString(DynamData[0]["F_WNEG__WLLZ_TEXT21"]);
                    F_WNEG_REMARK21 = Convert.ToString(DynamData[0]["F_WNEG_REMARK21"]);
                    F_WNEG_TEXT141 = Convert.ToString(DynamData[0]["F_WNEG_TEXT141"]);
                    F_WNEG_REMARK41 = Convert.ToString(DynamData[0]["F_WNEG_Remark41"]);
                    FNAME = Convert.ToString(DynamData[0]["FNAME"]);
                    F_WNEG_Text61= Convert.ToString(DynamData[0]["F_WNEG_Text61"]);
                    F_WNEG_TEXT71= Convert.ToString(DynamData[0]["F_WNEG_TEXT71"]);
                    F_WNEG_TEXT81= Convert.ToString(DynamData[0]["F_WNEG_TEXT81"]);
                    F_WNEG_TEXT91= Convert.ToString(DynamData[0]["F_WNEG_TEXT91"]);
                    F_WNEG_TEXT151 = Convert.ToString(DynamData[0]["F_WNEG_TEXT151"]);
                    F_WNEG_MULLANGTEXT1= Convert.ToString(DynamData[0]["F_WNEG_MULLANGTEXT1"]);
                    F_WNEG__QZPV_REMARK31= Convert.ToString(DynamData[0]["F_WNEG__QZPV_REMARK31"]);
                    F_WNEG_ASSISTANT111 = Convert.ToString(DynamData[0]["F_WNEG_ASSISTANT111"]);
                    F_WNEG_TaxRateId11 = Convert.ToString(DynamData[0]["F_WNEG_TaxRateId11"]);

                    if (F_WNEG_COMBO.Equals("0"))
                    {
                        if(!F_WNEG_TaxRateId11.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.FTAXRATEID1='{0}' from t_BD_MaterialBase t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG_TaxRateId11, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_SPECIFICATION1.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.FSPECIFICATION='{0}' from T_BD_MATERIAL_L t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG_SPECIFICATION1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_REMARK51.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_REMARK5='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG_REMARK51, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_ERPCLSID1.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.FERPCLSID='{0}' from t_BD_MaterialBase t
                            left join T_BD_MATERIAL t1 on t.FMATERIALID=t1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG_ERPCLSID1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__WLLZ_REMARK2.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WLLZ_REMARK='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__WLLZ_REMARK2, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_DATE1.Equals("0001-01-01 00:00:00"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_DATE='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG_DATE1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__WLLZ_TEXT13.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WLLZ_TEXT1='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__WLLZ_TEXT13, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__WLLZ_TEXT113.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WLLZ_TEXT11='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__WLLZ_TEXT113, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__WLLZ_TEXT1111.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WLLZ_TEXT111='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__WLLZ_TEXT1111, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__WLLZ_TEXT1121.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WLLZ_TEXT112='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__WLLZ_TEXT1121, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__WLLZ_TEXT121.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WLLZ_TEXT12='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__WLLZ_TEXT121, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_TEXT12.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_TEXT1='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG_TEXT12, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_TEXT3.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_TEXT='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG_TEXT3, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__WLLZ_REMARK11.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WLLZ_REMARK1='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__WLLZ_REMARK11, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__WLLZ_TEXT3.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WLLZ_TEXT='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__WLLZ_TEXT3, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_DEFAULTVENDOR1.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.FDEFAULTVENDORID='{0}' from t_bd_MaterialPurchase t
                            left join T_BD_MATERIAL t1 on t.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG_DEFAULTVENDOR1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__QZPV_REMARK2.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_QZPV_REMARK='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__QZPV_REMARK2, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__QZPV_REMARK11.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_QZPV_REMARK1='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__QZPV_REMARK11, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__QZPV_PRICE2.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_QZPV_PRICE='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__QZPV_PRICE2, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__QZPV_TEXT11.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_QZPV_TEXT1='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__QZPV_TEXT11, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__WLLZ_TAXRATEID1.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WLLZ_TAXRATEID='{0}' from t_BD_MaterialBase t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG__WLLZ_TAXRATEID1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__QZPV_PRICE11.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_QZPV_PRICE1='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__QZPV_PRICE11, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_ASSISTANT1.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_ASSISTANT='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG_ASSISTANT1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_TAXRATEID11.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.FTAXRATEID1='{0}' from t_BD_MaterialBase t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG_TAXRATEID11, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (Convert.ToDecimal(F_WNEG_DECIMAL4)!=0)
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_DECIMAL='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG_DECIMAL4, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_DECIMAL11.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_DECIMAL1='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG_DECIMAL11, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_DECIMAL21.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_DECIMAL4='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG_DECIMAL21, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_DECIMAL31.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_DECIMAL3='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG_DECIMAL31, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_TEXT21.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_TEXT3='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG_TEXT21, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_LENGTH1.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.FLENGTH='{0}' from t_BD_MaterialBase t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG_LENGTH1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_WIDTH1.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.FWIDTH='{0}' from t_BD_MaterialBase t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG_WIDTH1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_HEIGHT1.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.FHEIGHT='{0}' from t_BD_MaterialBase t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG_HEIGHT1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__WLLZ_QTY11.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WLLZ_QTY3='{0}' from t_BD_MaterialBase t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG__WLLZ_QTY11, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__WLLZ_QTY21.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WLLZ_QTY2='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__WLLZ_QTY21, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__WLLZ_QTY3.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WLLZ_QTY='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__WLLZ_QTY3, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__QZPV_LENGTH1.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_QZPV_LENGTH='{0}' from t_BD_MaterialBase t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG__QZPV_LENGTH1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__QZPV_WIDTH1.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_QZPV_WIDTH='{0}' from t_BD_MaterialBase t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG__QZPV_WIDTH1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__QZPV_HEIGHT1.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_QZPV_HEIGHT='{0}' from t_BD_MaterialBase t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG__QZPV_HEIGHT1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__QZPV_VOLUME1.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_QZPV_VOLUME='{0}' from t_BD_MaterialBase t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG__QZPV_VOLUME1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__QZPV_QTY1.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_QZPV_QTY='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__QZPV_QTY1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__WLLZ_TEXT21.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WLLZ_TEXT2='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__WLLZ_TEXT21, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_REMARK21.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_REMARK2='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG_REMARK21, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_TEXT141.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_TEXT16='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG_TEXT141, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_Text61.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_TEXT8='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG_Text61, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_TEXT71.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_TEXT9='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG_TEXT71, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_TEXT81.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_TEXT10='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG_TEXT81, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_TEXT91.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_TEXT11='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG_TEXT91, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__QZPV_REMARK31.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG__QZPV_REMARK='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__QZPV_REMARK31, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_TEXT151.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_TEXT17='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG_TEXT151, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_MULLANGTEXT1.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_MULLANGTEXT='{0}' from T_BD_MATERIAL_L t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG_MULLANGTEXT1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_REMARK41.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_REMARK4='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG_REMARK41, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!FNAME.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.FNAME='{0}' from T_BD_MATERIAL_L t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", FNAME, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_ASSISTANT111.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_ASSISTANT1='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG_ASSISTANT111, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        int FMATERIALID = 0;
                        string SQL01 = "/*dialect*/" + string.Format(@"select FMATERIALID from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", FNAME, F_WNEG_Text4);
                        DynamicObjectCollection DynamData01 = DBUtils.ExecuteDynamicObject(this.Context, SQL01);
                        if(DynamData01.Count>0)
                        {
                            FMATERIALID = Convert.ToInt32(DynamData01[0]["FMATERIALID"]);
                        }
                        //获取元数据服务

                        IMetaDataService metadataService = Kingdee.BOS.App.ServiceHelper.GetService<IMetaDataService>();

                        //获取保存服务

                        ISaveService saveService = Kingdee.BOS.App.ServiceHelper.GetService<ISaveService>();

                        //获取加载数据服务

                        IViewService viewService = Kingdee.BOS.App.ServiceHelper.GetService<IViewService>();



                        //获取物料元数据

                        FormMetadata materialMetadata = metadataService.Load(this.Context, "BD_Material") as FormMetadata;

                        //获取id为10001的物料数据

                        DynamicObject[] objs = viewService.Load(

                            this.Context,

                            new object[] { FMATERIALID },

                              materialMetadata.BusinessInfo.GetDynamicObjectType());

                        //保存id为10001的物料

                        saveService.Save(this.Context, objs);

                        saveService.Save(this.Context, materialMetadata.BusinessInfo, objs);
                     

                    }
                    if (F_WNEG_COMBO.Equals("1"))
                    {
                        if (!F_WNEG_REMARK41.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_REMARK4='{0}' from WNEG_t_Cust100018 t
                            WHERE T.F_WNEG_TEXT1='{1}'", F_WNEG_REMARK41, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                            SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_REMARK4='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG_REMARK41, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__WLLZ_TEXT3.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG__WLLZ_TEXT='{0}' from WNEG_t_Cust100018 t
                            WHERE T.F_WNEG_TEXT1='{1}'", F_WNEG__WLLZ_TEXT3, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                            SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WLLZ_Text='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__WLLZ_TEXT3, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__QZPV_PRICE2.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG__QZPV_PRICE='{0}' from WNEG_t_Cust100018 t
                            WHERE T.F_WNEG_TEXT1='{1}'", F_WNEG__QZPV_PRICE2, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                            SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_QZPV_PRICE='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__QZPV_PRICE2, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__QZPV_PRICE11.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG__QZPV_PRICE='{0}' from WNEG_t_Cust100018 t
                            WHERE T.F_WNEG_TEXT1='{1}'", F_WNEG__QZPV_PRICE11, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                            SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_QZPV_PRICE1='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__QZPV_PRICE11, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__WLLZ_TAXRATEID1.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WLLZ_TAXRATEID1='{0}' from WNEG_t_Cust100018 t
                            WHERE T.F_WNEG_TEXT1='{1}'", F_WNEG__WLLZ_TAXRATEID1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                            SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WLLZ_TAXRATEID='{0}' from t_BD_MaterialBase t
                            left join T_BD_MATERIAL t1 on t.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG__WLLZ_TAXRATEID1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__QZPV_TEXT11.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG__QZPV_TEXT1='{0}' from WNEG_t_Cust100018 t
                            WHERE T.F_WNEG_TEXT1='{1}'", F_WNEG__QZPV_TEXT11, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                            SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_QZPV_TEXT1='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__QZPV_TEXT11, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_SPECIFICATION1.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_SPECIFICATION='{0}' from WNEG_t_Cust100018_l t
                            left join WNEG_t_Cust100018 t1 on t.fid=t1.fid
                            WHERE T1.F_WNEG_TEXT1='{1}'", F_WNEG_SPECIFICATION1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                            SQL0 = "/*dialect*/" + string.Format(@"update t set t.FSPECIFICATION='{0}' from T_BD_MATERIAL_L t
                            left join T_BD_MATERIAL t1 on t.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG_SPECIFICATION1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__QZPV_REMARK2.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG__QZPV_REMARK='{0}' from WNEG_t_Cust100018 t
                            WHERE T.F_WNEG_TEXT1='{1}'", F_WNEG__QZPV_REMARK2, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                            SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_QZPV_REMARK='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__QZPV_REMARK2, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_LENGTH1.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_LENGTH='{0}' from WNEG_t_Cust100018 t
                            WHERE T.F_WNEG_TEXT1='{1}'", F_WNEG_LENGTH1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                            SQL0 = "/*dialect*/" + string.Format(@"update t set t.FLENGTH='{0}' from t_BD_MaterialBase t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG_LENGTH1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_WIDTH1.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_WIDTH='{0}' from WNEG_t_Cust100018 t
                            WHERE T.F_WNEG_TEXT1='{1}'", F_WNEG_WIDTH1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                            SQL0 = "/*dialect*/" + string.Format(@"update t set t.FWIDTH='{0}' from t_BD_MaterialBase t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG_WIDTH1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_HEIGHT1.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG_HEIGHT='{0}' from WNEG_t_Cust100018 t
                            WHERE T.F_WNEG_TEXT1='{1}'", F_WNEG_HEIGHT1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                            SQL0 = "/*dialect*/" + string.Format(@"update t set t.FHEIGHT='{0}' from t_BD_MaterialBase t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG_HEIGHT1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__WLLZ_QTY11.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG__WLLZ_QTY1='{0}' from WNEG_t_Cust100018 t
                            WHERE T.F_WNEG_TEXT1='{1}'", F_WNEG__WLLZ_QTY11, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                            SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WLLZ_QTY3='{0}' from t_BD_MaterialBase t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG__WLLZ_QTY11, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__WLLZ_QTY21.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG__WLLZ_QTY2='{0}' from WNEG_t_Cust100018 t
                            WHERE T.F_WNEG_TEXT1='{1}'", F_WNEG__WLLZ_QTY21, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                            SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WLLZ_QTY2='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__WLLZ_QTY21, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__WLLZ_QTY3.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG__WLLZ_QTY='{0}' from WNEG_t_Cust100018 t
                            WHERE T.F_WNEG_TEXT1='{1}'", F_WNEG__WLLZ_QTY3, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                            SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WLLZ_QTY='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__WLLZ_QTY3, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__QZPV_LENGTH1.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG__QZPV_LENGTH='{0}' from WNEG_t_Cust100018 t
                            WHERE T.F_WNEG_TEXT1='{1}'", F_WNEG__QZPV_LENGTH1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                            SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_QZPV_LENGTH='{0}' from t_BD_MaterialBase t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG__QZPV_LENGTH1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__QZPV_WIDTH1.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG__QZPV_WIDTH='{0}' from WNEG_t_Cust100018 t
                            WHERE T.F_WNEG_TEXT1='{1}'", F_WNEG__QZPV_WIDTH1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                            SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_QZPV_WIDTH='{0}' from t_BD_MaterialBase t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG__QZPV_WIDTH1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__QZPV_HEIGHT1.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG__QZPV_HEIGHT='{0}' from WNEG_t_Cust100018 t
                            WHERE T.F_WNEG_TEXT1='{1}'", F_WNEG__QZPV_HEIGHT1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                            SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_QZPV_HEIGHT='{0}' from t_BD_MaterialBase t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG__QZPV_HEIGHT1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__QZPV_VOLUME1.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG__QZPV_VOLUME='{0}' from WNEG_t_Cust100018 t
                            WHERE T.F_WNEG_TEXT1='{1}'", F_WNEG__QZPV_VOLUME1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                            SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_QZPV_VOLUME='{0}' from t_BD_MaterialBase t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG__QZPV_VOLUME1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG__QZPV_QTY1.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_WNEG__QZPV_QTY='{0}' from WNEG_t_Cust100018 t
                            WHERE T.F_WNEG_TEXT1='{1}'", F_WNEG__QZPV_QTY1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                            SQL0 = "/*dialect*/" + string.Format(@"update t set t.F_QZPV_QTY='{0}' from T_BD_MATERIAL t
                            WHERE T.FNUMBER='{1}'", F_WNEG__QZPV_QTY1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!F_WNEG_DEFAULTVENDOR1.Equals("0"))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.FSUPPLIERID='{0}' from WNEG_t_Cust100018 t
                            WHERE T.F_WNEG_TEXT1='{1}'", F_WNEG_DEFAULTVENDOR1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                            SQL0 = "/*dialect*/" + string.Format(@"update t set t.FDEFAULTVENDORID='{0}' from t_bd_MaterialPurchase t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", F_WNEG_DEFAULTVENDOR1, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                        if (!FNAME.Equals(""))
                        {
                            string SQL0 = "/*dialect*/" + string.Format(@"update t set t.FNAME='{0}' from WNEG_t_Cust100018_L t
                            LEFT JOIN WNEG_t_Cust100018 T1 ON T.FID=T1.FID
                            WHERE T1.F_WNEG_TEXT1='{1}'", FNAME, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                            SQL0 = "/*dialect*/" + string.Format(@"update t set t.FNAME='{0}' from T_BD_MATERIAL_L t
                            LEFT JOIN T_BD_MATERIAL T1 ON T.FMATERIALID=T1.FMATERIALID
                            WHERE T1.FNUMBER='{1}'", FNAME, F_WNEG_Text4);
                            DBUtils.ExecuteDynamicObject(this.Context, SQL0);
                        }
                    }
                }
            }
        }
    }
}
